package examples;

public class Singleton {
    private static volatile Singleton INSTANCE;
    private int i = 0;

    private Singleton(){
        this.i++;
    }

    public static Singleton getInstance(){
        if(INSTANCE == null){
            synchronized (Singleton.class){
                INSTANCE = new Singleton();
            }
        }
        return INSTANCE;
    }

    public int getI() {
        return i;
    }
}
